#ifndef MESSENGER_H
#define MESSENGER_H

#include <QWidget>
#include "DbConnection.h"
#include "vtable.h"
class Messenger : public QDialog
{
    Q_OBJECT
public:
    explicit Messenger(DbConnection* Db, QWidget *Parent = 0);
private:
    struct Message
    {
        int id;
        QString text, fid;
        QDateTime date;
        bool confirmed;
        bool reminder;
    };
    DbConnection* m_db;
    QList<Message> m_messages;
    vTable* table;
    QString gcm(const int&count) const;
signals:
    void messageDoubleClicked(const QString&FID);
    void messageConfirmed(const int&,const int&,const QIcon&);
    void newMessages(const QString&);
private slots:
    void onCellDoubleClicked(const int&row, const int&col);
    void onCellActivated(const int&row, const int&col);
    void setConfirmed(const int&Index);
public slots:
    void loadMessages();
    void readMessages();
};

#endif // MESSENGER_H
